const http = require('http')

// 1.创建server服务器
const server = http.createServer((req, res) => {
  console.log(req.url)
  console.log(req.method)
  console.log(req.headers)
  // {
  //   host: 'localhost:8000',
  //   connection: 'keep-alive',
  //   pragma: 'no-cache',
  //   'cache-control': 'no-cache',
  //   'sec-ch-ua-platform': '"Windows"',
  //   'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36',       
  //   'sec-ch-ua': '"Chromium";v="136", "Google Chrome";v="136", "Not.A/Brand";v="99"',
  //   'sec-ch-ua-mobile': '?0',
  //   accept: 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8',
  //   'sec-fetch-site': 'same-origin',
  //   'sec-fetch-mode': 'no-cors',
  //   'sec-fetch-dest': 'image',
  //   referer: 'http://localhost:8000/',
  //   'accept-encoding': 'gzip, deflate, br, zstd',
  //   'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8'
  // }
  res.end('hello world 张三')
})


// 2.开启server服务器
server.listen(8000, () => {
  console.log('服务器开启成功~')
})
